const viewList = () => {

}
//代码执行耗时
function triggerDelay() {
    console.time('代码执行耗时')
    let cnt = 0;
    for (let i = 0; i < 20e8 * 2; i += 1) {
        cnt += 1;
    }
    console.timeEnd('代码执行耗时')
}
//时间格式化
const formatDate = (t1, format = 'YYYY-MM-DD HH:mm:ss') => {
    const config = {
        YYYY: t1.getFullYear(),
        MM: (t1.getMonth() + 1).toString().padStart(2, '0'),
        DD: t1.getDate().toString().padStart(2, '0'),
        HH: t1.getHours().toString().padStart(2, '0'),
        mm: t1.getMinutes().toString().padStart(2, '0'),
        ss: t1.getSeconds().toString().toString().padStart(2, '0')
    };
    for (const key in config) {
        format = format.replace(key, config[key])
    }
    return format
}
//判断是否为移动设备
function isMobile() {
    // 判断是否为移动设备
    return (
        typeof window.orientation !== "undefined" || // 判断是否存在window.orientation属性，此属性在移动设备上一般存在
        navigator.userAgent.indexOf('IEMobile') !== -1 || // 判断是否为Windows Phone
        navigator.userAgent.indexOf('iPhone') !== -1 || // 判断是否为iPhone
        navigator.userAgent.indexOf('Android') !== -1 && navigator.userAgent.indexOf('Mobile') !== -1 || // 判断是否为Android手机
        navigator.userAgent.indexOf('BlackBerry') !== -1 || // 判断是否为BlackBerry
        navigator.userAgent.indexOf('Opera Mini') !== -1 // 判断是否为Opera Mini浏览器
    );
}

export {
    formatDate,
    viewList,
    triggerDelay,
    isMobile
}